﻿using MediatR;
using S.EarTag.API.Mediator.MediatorCommand.MarkCommand;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;

namespace S.EarTag.API.Mediator.MediatorCommandHandler.MarkCommandHandler
{
    public class MarkDeleteCommandHandler : IRequestHandler<MarkDeleteCommand, bool>
    {
        private readonly IMarkModelRepository _markModelRepository;
        public MarkDeleteCommandHandler(IMarkModelRepository markModelRepository)
        {
            _markModelRepository = markModelRepository;
        }
        /// <summary>
        /// 根据Id删除戴标数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<bool> Handle(MarkDeleteCommand request, CancellationToken cancellationToken)
        {
            return await _markModelRepository.DeleteAsync(request.MarkId);
        }
    }
}
